package kolekcje.eng.powtorka.bis;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class MusicBoxSetter {

	public static String[] listaUtworow = {"Pink Moon/Nick Drake/5/80",
			"Somersault/Zero 7/4/84",
			"Shiva Moon/Prem Joshua/6/120",
			"Circles/BT/5/110",
			"Deep Channel/Afro Celts/4/120",
			"Passenger/Headmix/4/100",
			"Listen/Tahiti 80/5/90"};
	
	public static File plik = new File("songsBis.txt");
	
	public static void main(String[] args) {

		try {
			BufferedWriter bw = new BufferedWriter(new FileWriter(plik));
			for(String e : listaUtworow)
				bw.write(e + "\r\n");
			System.out.println("Zapisano " + plik.getName());
			System.out.println(plik.getAbsolutePath() + "\n");
			bw.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		try {
			BufferedReader br = new BufferedReader(new FileReader(plik));
			String s;
			while((s = br.readLine()) != null)
				System.out.println(s);
			br.close();
		} catch (FileNotFoundException e) {
			System.out.println("Nie odnaleziono pliku");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
